% by YLX on 6/10
% Version 2.3
% Update log 
%% renamed to prunePIE
%% added support for removing unreasonable pies 
function pruned = prunePIE(PIE, s_row)
    global J
    % pie(j) <= S(i, j)
    pruned = zeros(1, J);
    for row = 1:size(PIE, 1)
        if sum(PIE(row,:)<=s_row) == 3
            pruned(end+1, :) = PIE(row, :); % append a row to the end
        end
    end
    pruned = pruned(2:end,:); % remove the first row of 0s 
    return;
    